import {createSlice,createAsyncThunk} from "@reduxjs/toolkit"

export const asyncchangemsg = createAsyncThunk('asyncchangemsg',async ()=>{
    const res = await new Promise((resolve)=>{
        setTimeout(()=>{
            resolve('asyncchangemsg')
        },1500)
    })
})

const msgSlice = createSlice({
    name:"msgSlice",
    initialState:{
        msg:"初始数据"
    },
    reducers:{
        changemsg(state,action){
            state.msg = action.payload
        }
    },
    extraReducers:{
        [asyncChangeNum.fulfilled]:(state,action)=>{
            state.num  = action.payload
        }
    }
    
})



